package com.fz.song.web.controller;

import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.fz.song.framework.common.R;
import com.fz.song.web.entity.User;
import com.fz.song.web.service.IUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 77088
 * @title: OptimisticLockingController
 * @projectName idempotent-demo
 * @description: TODO
 * @date 2021/11/119:13
 */

@Api(tags = "幂等性demo-悲观锁")
@Slf4j
@RestController
@RequestMapping("idempotent")
public class PessimismLockingController {

    @Autowired
    private IUserService userService;




    @ApiOperation(value = "悲观转账", notes = "悲观转账")
    @GetMapping("transferPessimism")
    public R transfer() {
        //用户id为1的给用户id为2的转账100;
        Boolean bool = userService.transferPessimism(2, 1, 100);
        return R.ok("转账", bool);
    }


}
